25 #ifndef __CMSIS_COMPILER_H 26 #define __CMSIS_COMPILER_H 33 #if defined ( __CC_ARM ) 34 #include "cmsis_armcc.h" 40 #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 41 #include "cmsis_armclang.h" 47 #elif defined ( __GNUC__ ) 54 #elif defined ( __ICCARM__ ) 55 #include <cmsis_iccarm.h> 61 #elif defined ( __TI_ARM__ ) 62 #include <cmsis_ccs.h> 68 #define __INLINE inline 70 #ifndef __STATIC_INLINE 71 #define __STATIC_INLINE static inline 74 #define __NO_RETURN __attribute__((noreturn)) 77 #define __USED __attribute__((used)) 80 #define __WEAK __attribute__((weak)) 83 #define __PACKED __attribute__((packed)) 85 #ifndef __PACKED_STRUCT 86 #define __PACKED_STRUCT struct __attribute__((packed)) 88 #ifndef __PACKED_UNION 89 #define __PACKED_UNION union __attribute__((packed)) 91 #ifndef __UNALIGNED_UINT32 93 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) 95 #ifndef __UNALIGNED_UINT16_WRITE 97 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void*)(addr))->v) = (val)) 99 #ifndef __UNALIGNED_UINT16_READ 101 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) 103 #ifndef __UNALIGNED_UINT32_WRITE 105 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) 107 #ifndef __UNALIGNED_UINT32_READ 109 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) 112 #define __ALIGNED(x) __attribute__((aligned(x))) 115 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. 123 #elif defined ( __TASKING__ ) 134 #define __INLINE inline 136 #ifndef __STATIC_INLINE 137 #define __STATIC_INLINE static inline 140 #define __NO_RETURN __attribute__((noreturn)) 143 #define __USED __attribute__((used)) 146 #define __WEAK __attribute__((weak)) 149 #define __PACKED __packed__ 151 #ifndef __PACKED_STRUCT 152 #define __PACKED_STRUCT struct __packed__ 154 #ifndef __PACKED_UNION 155 #define __PACKED_UNION union __packed__ 157 #ifndef __UNALIGNED_UINT32 158 struct __packed__ T_UINT32 { uint32_t v; };
159 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) 161 #ifndef __UNALIGNED_UINT16_WRITE 163 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) 165 #ifndef __UNALIGNED_UINT16_READ 167 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) 169 #ifndef __UNALIGNED_UINT32_WRITE 171 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) 173 #ifndef __UNALIGNED_UINT32_READ 175 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) 178 #define __ALIGNED(x) __align(x) 181 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. 189 #elif defined ( __CSMC__ ) 190 #include <cmsis_csm.h> 196 #define __INLINE inline 198 #ifndef __STATIC_INLINE 199 #define __STATIC_INLINE static inline 206 #warning No compiler specific solution for __USED. __USED is ignored. 210 #define __WEAK __weak 213 #define __PACKED @packed 215 #ifndef __PACKED_STRUCT 216 #define __PACKED_STRUCT @packed struct 218 #ifndef __PACKED_UNION 219 #define __PACKED_UNION @packed union 221 #ifndef __UNALIGNED_UINT32 222 @packed
struct T_UINT32 { uint32_t v; };
223 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) 225 #ifndef __UNALIGNED_UINT16_WRITE 227 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) 229 #ifndef __UNALIGNED_UINT16_READ 231 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) 233 #ifndef __UNALIGNED_UINT32_WRITE 235 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) 237 #ifndef __UNALIGNED_UINT32_READ 239 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) 242 #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored. 246 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. 252 #error Unknown compiler. CMSIS compiler GCC header file.
__PACKED_STRUCT T_UINT16_WRITE
struct __attribute__((packed)) T_UINT32
__PACKED_STRUCT T_UINT32_WRITE
__PACKED_STRUCT T_UINT32_READ
__PACKED_STRUCT T_UINT16_READ